Skip to content

feat(ui): raster cell + time axes; centralize viridis colormap#159

Merged
daharoni merged 3 commits into
mainfrom
feat/raster-axes-colorbar
Jul 8, 2026
Merged

feat(ui): raster cell + time axes; centralize viridis colormap#159
daharoni merged 3 commits into
mainfrom
feat/raster-axes-colorbar

Conversation

@daharoni

@daharoni daharoni commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What

The Raster Overview was a bare canvas heatmap — no axes. This adds:

  • Cell axis (left) — cell index, increasing downward.
  • Time axis (bottom) — seconds when the sampling rate is known, else frame index.

The heatmap now renders into an inner plot rect with reserved left/bottom margins; the subset overlay boxes (K1..Kn) and click hit-testing are offset to match.

No intensity colorbar: viridis runs low→high activity, the absolute values aren't meaningful, and it's a standard enough colormap that a legend just adds clutter. (An earlier revision added one; removed per review.)

Centralization

Per the "CaDecon is one of several CaLab apps — centralize shared code" guideline, the reusable pieces move into @calab/ui/chart:

  • colormap.tsVIRIDIS_LUT (+ viridisRGB / viridisCss helpers for future heatmaps). The viridis LUT was previously CaDecon-local; it still backs the raster heatmap and is now available to any app.
  • chart-math.tsniceTicks() (1/2/5×10^k axis ticks with fp-residue rounding), unit-tested.

The raster's warm subset-overlay palette stays local and is intentionally not the Okabe-Ito series palette — its purpose is contrast against viridis (purple-teal-yellow), not categorical distinctness among series. Noted in-code.

Verification

  • typecheck, eslint, prettier, and all 289 TS tests pass (incl. 4 new niceTicks tests).
  • Browser (synthetic GCaMP6f, 40 cells / 5 min): axes labeled 0–40 cells and 0–300 s, subset boxes correctly positioned within the plot rect.

Follow-ups (deferred)

The axis-config/legend de-duplication across the uPlot charts (the audit found the AXIS_* block copy-pasted 6+ times) remains for a later refactor PR.

daharoni and others added 2 commits July 8, 2026 13:18
The RasterOverview was a bare canvas heatmap with no axes and no intensity
legend. Add a cell axis (left), a time axis (bottom, seconds when the sampling
rate is known, else frame index), and a vertical viridis colorbar (right) with
min/mid/max tick labels for the 1st/99th-percentile intensity range. The
heatmap now renders into an inner plot rect with reserved margins; subset
overlay boxes and click hit-testing are offset to match.

Centralize the reusable pieces into @calab/ui/chart rather than leaving them
CaDecon-local (CaDecon is one of several CaLab apps):
- colormap.ts: VIRIDIS_LUT + viridisRGB/viridisCss — the standard scientific
  sequential colormap, now available to any app's heatmaps.
- chart-math.ts: niceTicks() for 1/2/5×10^k axis ticks, with fp-residue
  rounding; unit-tested.

The raster's warm subset-overlay palette stays local and intentionally distinct
from the Okabe-Ito series palette — its job is contrast against viridis, not
categorical distinctness.

Verified: typecheck, eslint, prettier, 289 TS tests (incl. new niceTicks tests);
browser shows labeled axes + colorbar with correctly-positioned subset boxes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per review: the raster runs low→high activity on a standard viridis colormap
and the absolute intensity values aren't meaningful, so the colorbar added
clutter without information. Keep the cell and time axes; reclaim the right
margin for the heatmap. VIRIDIS_LUT (shared) still backs the heatmap itself.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@daharoni daharoni changed the title feat(ui): raster axes + intensity colorbar; centralize viridis colormap feat(ui): raster cell + time axes; centralize viridis colormap Jul 8, 2026
drawAxes leaves ctx.textAlign='right'/textBaseline='middle'; drawSubsets drew
the K-labels without resetting, so each label rendered right-aligned and
vertically centered — landing outside its shaded background box. Reset to
left/alphabetic before the label loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@daharoni daharoni merged commit 322b2a4 into main Jul 8, 2026
6 checks passed
@daharoni daharoni deleted the feat/raster-axes-colorbar branch July 8, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant